<?php
if(file_exists("./cms".HOST.".css"))
{
	$strSiteCSS = "cms".HOST.".css";
}
else
{
	$strSiteCSS = "shop.css";		
}
?>


<script language="javascript" type="text/javascript" src="/vendere-jscript/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
	theme : "advanced",
	ask : false,
	plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu",
	theme_advanced_buttons1_add_before : "save,separator",
	theme_advanced_buttons1_add : "fontselect,fontsizeselect",
	theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",
	theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator",
	theme_advanced_buttons3_add_before : "tablecontrols,separator",
	theme_advanced_buttons3_add : "emotions,iespell,flash,advhr,separator,print",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_path_location : "bottom",
	theme_advanced_resizing : true,
	// Example content CSS (should be your site CSS)
	content_css : "<?php echo $strSiteCSS;?>",
	plugin_insertdate_dateFormat : "%Y-%m-%d",
	plugin_insertdate_timeFormat : "%H:%M:%S",
	extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
	spellchecker_languages : "+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv"
	
});

function toggleEditor(id) {
	var elm = document.getElementById(id);

	if (tinyMCE.getInstanceById(id) == null)
		tinyMCE.execCommand('mceAddControl', false, id);
	else
		tinyMCE.execCommand('mceRemoveControl', false, id);
}
</script>
<?php

$strScreenName = 'EnterCategory';
$strQueryName = 'qryAddCategory';
$strFormName = 'frmEnterCategory';

     if (($intCategoryID) && (!$strReprocessing)) {
             include (MODULE . "/action/qrySelectCategory");
			 $strButtonTitle = "update";
			 $strFormTitle = "Update ".$myrow["Category"]."&nbsp;(".$myrow["ID"].")";
             $cboID = stripslashes($myrow["ID"]);
             $txtCategory = stripslashes($myrow["Category"]);
             $txtDescription = stripslashes($myrow["Description"]);
             $txtUploadedPicture = stripslashes($myrow["UploadedPicture"]);
			 $txtMetaTitle = stripslashes($myrow["MetaTitle"]);
             $txtMetaDescription = stripslashes($myrow["MetaDescription"]);
             $txtMetaKeyword = stripslashes($myrow["MetaKeyword"]);
             $txtMetaComment = stripslashes($myrow["MetaComment"]);
         }else{
		 	$strFormTitle = "Enter New Category";
			$strButtonTitle = "save";
			$txtCategory = stripslashes(eregi_replace('\"', "&quot;", $txtCategory));
            $txtDescription = stripslashes(eregi_replace('\"', "&quot;", $txtDescription));
			if($txtMetaTitle){ $txtMetaTitle = stripslashes(eregi_replace('\"', "&quot;", $txtMetaTitle)); }
            if($txtMetaDescription){ $txtMetaDescription = stripslashes(eregi_replace('\"', "&quot;", $txtMetaDescription)); }
            if($txtMetaKeyword){ $txtMetaKeyword = stripslashes(eregi_replace('\"', "&quot;", $txtMetaKeyword)); }
            if($txtMetaComment){ $txtMetaComment = stripslashes(eregi_replace('\"', "&quot;", $txtMetaComment)); }
     }
echo (StartForm($strScreenName, "post", $strQueryName,array('intCategoryID'=>$intCategoryID,'strReprocessing'=>'True'),"","multipart/form-data",$strFormName,"","return frmEnterCategory_onsubmit()"));
     
if($strStyleSheet == TRUE){
	echo "<table class='Normal' border='0' align='left' width='450'>";
}		 
     
echo "
<tr>
     <td>
         <table  width='450' cellpadding='0' cellspacing='0' border='0' class='Normal' align='center'>
     <tr align='left'>
         <td align='left' colspan='2'>
             <H2>$strFormTitle</H2>
         </td>
     </tr>

     <tr>
         <td align='left' colspan='2'>
             <b>Category Name :&nbsp;</b><br/>
             <input type=\"text\" name=\"txtCategory\" value = \"$txtCategory\" size= \"63\" maxlength=\"60\">
         </td>
     </tr>

     <tr  align='left'>
         <td align='left' colspan='2'>
             <b>Description :</b>
             <br />
			<a href=\"javascript:toggleEditor('txtDescription');\">Add/Remove editor</a><br />
             <textarea id='txtDescription' cols=60 rows=6 name=\"txtDescription\">$txtDescription</textarea>
         </td>
     </tr>

     <tr>
         <td align='left' colspan='2'>
             <b>Picture :&nbsp;</b><br/>";
             CreateDropDown("cboUploadedPicture", "SELECT * FROM tblYesNo ORDER BY 2", "", $cboUploadedPicture);
echo "
             <input type=\"file\" name=\"txtUploadedPicture\" value = \"$txtUploadedPicture\" size= \"53\" maxlength=\"50\">
         </td>
     </tr>

     <tr>
         <td align='left' colspan='2'>
             <b>Meta Title :&nbsp;</b>
             <br /><input type=\"text\" name=\"txtMetaTitle\" value = \"$txtMetaTitle\" size= \"63\" maxlength=\"65\">
         </td>
     </tr>

     <tr>
         <td align='left' colspan='2'>
             <b>Meta Description :&nbsp;</b><br/>
             <textarea cols=60 rows=3 name=\"txtMetaDescription\">$txtMetaDescription</textarea>
         </td>
     </tr>

     <tr  align='left'>
         <td align='left' colspan='2'>
             <b>Meta Keyword :</b>
			 <input type=\"text\" name=\"txtMetaKeyword\" value = \"$txtMetaKeyword\" size= \"63\" maxlength=\"300\">
         </td>
     </tr>

     <tr>
         <td align='left' colspan='2'>
             <b>Meta Comment :&nbsp;</b><br/>

             <input type=\"text\" name=\"txtMetaComment\" value = \"$txtMetaComment\" size= \"63\" maxlength=\"200\">
         </td>
     </tr>

     <tr>
         <td align='right' colspan='2'>
             <input type='image' src='./images".SITE_SUFFIX."/$strButtonTitle.gif' alt='$strButtonTitle'>
         </td>
     </tr>
         </table
     
     </td>
 </tr>
";
     //$strListAll = "true";
       //include (MODULE . "/screen/ListCategory");

	if($strStyleSheet == TRUE){
   		echo "</table>";
	}

?>
</form>
<script language="JavaScript">
<!--
function frmEnterCategory_onsubmit() 
{


     if(document.frmEnterCategory.txtCategory.value == "") {
         alert("Please enter Category Name");
         document.frmEnterCategory.txtCategory.focus();
         document.frmEnterCategory.txtCategory.select();
         return(false);
     }

     if(document.frmEnterCategory.txtDescription.value == "") {
         alert("Please enter Description");
         document.frmEnterCategory.txtDescription.focus();
         document.frmEnterCategory.txtDescription.select();
         return(false);
     }

	 if(document.frmEnterCategory.txtMetaTitle.value == "") {
         alert("Please enter Meta Title");
         document.frmEnterCategory.txtMetaTitle.focus();
         document.frmEnterCategory.txtMetaTitle.select();
         return(false);
     }

     if(document.frmEnterCategory.txtMetaDescription.value == "") {
         alert("Please enter Meta Description");
         document.frmEnterCategory.txtMetaDescription.focus();
         document.frmEnterCategory.txtMetaDescription.select();
         return(false);
     }

     if(document.frmEnterCategory.txtMetaKeyword.value == "") {
         alert("Please enter Meta Keyword");
         document.frmEnterCategory.txtMetaKeyword.focus();
         document.frmEnterCategory.txtMetaKeyword.select();
         return(false);
	 }

}
// -->
</script>
